home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1987 December / Ahoy_Magazine_87-12_1987_Double_L.d64 / redirect 128 (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  1KB  |  50 lines

  1. 0 rem *** redirect c-128 ***
  2. 10 printchr$(147)tab(16)chr$(18)"redirect"
  3. 20 l$=" --------------------------------------"
  4. 30 j=0:s=1:n$="":print:print"file name? ";:printchr$(34);
  5. 40 poke2599,0:geta$:ifa$=""then40
  6. 50 ifa$=chr$(13)thenpoke2599,1:printchr$(34)a$:goto110
  7. 60 ifj>15thenpoke2599,1:printa$:goto100
  8. 70 ifa$=chr$(20)andj<1then40
  9. 80 printa$;:ifa$=chr$(20)thenj=j-1:n$=left$(n$,j):goto40
  10. 90 n$=n$+a$:j=j+1:goto40
  11. 100 print:printchr$(18)"you are over the 16 character limit.":goto30
  12. 110 ifn$=""thenprintchr$(18)"please enter a file name.":goto30
  13. 120 ifn$="$"then(NULL):poke208,0:gosub460:close15:printl$:goto30
  14. 130 r$=chr$(34)+n$+chr$(34)
  15. 140 print"searching for ";r$
  16. 150 iflen(n$)<16thenn$=n$+chr$(160):goto150
  17. 160 open15,8,15:open5,8,5,"#"
  18. 170 print#15,"u1";5;0;18;s:gosub470:l=4
  19. 180 b$="":j=1
  20. 190 print#15,"b-p";5;j+l:get#5,a$:ifa$=""thena$=chr$(0)
  21. 200 b$=b$+a$:ifleft$(b$,j)<>left$(n$,j)then230
  22. 210 j=j+1:ifj>16then280
  23. 220 goto190
  24. 230 l=l+32:ifl<229then180
  25. 240 forp=0to1:print#15,"b-p";5;p:get#5,a$:ifa$=""thena$=chr$(0)
  26. 250 a(p)=asc(a$):nextp:ifa(0)<>18ora(1)<1ora(1)>18then270
  27. 260 s=a(1):goto170
  28. 270 print:print"unable to locate ";r$:goto380
  29. 280 gosub430:print:printl$:ifct=1then300
  30. 290 f1$=f2$:s1=s:l1=l:ct=1:close5:close15:goto30
  31. 300 print"swapping...":printl$
  32. 310 print#15,"u1";5;0;18;s:gosub470
  33. 320 print#15,"b-p";5;l:print#5,f1$;
  34. 330 print#15,"u2";5;0;18;s:gosub470
  35. 340 print#15,"u1";5;0;18;s1:gosub470
  36. 350 print#15,"b-p";5;l1:print#5,f2$;
  37. 360 print#15,"u2";5;0;18;s1:gosub470
  38. 370 print"done..."
  39. 380 close5:close15:printl$:print
  40. 390 input"another swap (y/n/$)";a$:ifa$="y"thenclr:goto10
  41. 400 ifa$="n"thenend
  42. 410 ifa$="$"then(NULL):poke208,0:gosub460:close15:printl$:print
  43. 420 goto390
  44. 430 f2$="":l=l-2:forj=0to29
  45. 440 print#15,"b-p";5;j+l:get#5,a$:ifa$=""thena$=chr$(0)
  46. 450 f2$=f2$+a$:nextj:return
  47. 460 open15,8,15
  48. 470 input#15,en,em$,et,es:ifen=0thenreturn
  49. 480 printen;em$;et;es:close5:close15:end
  50.